FROM centos:7.6.1810

COPY ./ /home/soft
COPY ./kafka-start.sh /home

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' >/etc/timezone && \
mkdir /home/kafka && chmod +x /home/kafka-start.sh && \
tar xzf /home/soft/jdk-8u271-linux-x64.tar.gz -C /usr/local && \
tar xzf /home/soft/kafka_2.12-2.4.0.tgz -C /home/kafka --strip-components 1 && \
rm -rf /home/soft && \
sed -i '32alisteners=PLAINTEXT://adkafka.com:9092' /home/kafka/config/server.properties

ENV JAVA_HOME=/usr/local/jdk1.8.0_271
ENV JRE_HOME=/usr/local/jdk1.8.0_271/jre
ENV CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
ENV PATH=$PATH:${JAVA_HOME}/bin


EXPOSE 9092 2181

CMD ["/home/kafka-start.sh"]


# docker build -t adkafka:1.0 ./

# docker network create --subnet=172.11.0.0/16 adongnet

# docker run -it --name adkafka -h adkafka.com -p 9092:9092 -p 2181:2181 adkafka:1.0
